<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/1/9
 * Time: 15:11
 */
class Pay extends CI_Controller{
    /*
     * 构造函数  初始化
     */
    public function __construct()
    {
        parent::__construct();
        $this->load->library('ResponseUtil', null, 'resp');
        $this->load->model("paymodel");
    }

    /**
     * 获取付款信息
     */
    public function php_getPayLog(){
        date_default_timezone_set('PRC');
        $params = json_decode($this->input->post('param'), true);
        $payList = $this->paymodel->getPayLog($params['openid']);
        for($i = 0;$i<count($payList);$i++){
            $payList[$i]['fee'] = $payList[$i]['fee']/100;
            $timeStamp = $payList[$i]['createtime'];
            $time = date("Y-m-d",strtotime($timeStamp));
            $payList[$i]['createtime'] = $time;
        }
        $this->resp->success($payList);
    }

    /**
     * 添加套餐刷新次数
     */
    public function php_addPayCount(){
        $params = json_decode($this->input->post('param'), true);
        $this->paymodel->addPayCount($params['openid'],$params['fee']);
    }
}